﻿using Application.Dto;
using Application.IAppSrevices;
using AutoMapper;
using Domain.Entitys;
using Domain.Repositorys;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Application.AppSrevices
{
    public class SGDService : ISGDService
    {
        private readonly ISGDRepositoty sGDRepositoty;
        private readonly IMapper mapper;

        public SGDService(ISGDRepositoty sGDRepositoty,IMapper mapper)
        {
            this.sGDRepositoty = sGDRepositoty;
            this.mapper = mapper;
        }

        /// <summary>
        /// 添加薪酬详细嘻嘻数据
        /// </summary>
        /// <param name="sGD"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task<int> SGDAddAsync(List<SGDAddDto> sGDAddDtos)
        {
            List<SGD> sGDs = mapper.Map<List<SGD>>(sGDAddDtos);
            return await sGDRepositoty.SGDAddAsync(sGDs);
        }

        /// <summary>
        /// 根据薪酬发放编号查询对应薪酬详细数据
        /// </summary>
        /// <param name="sid"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task<List<SGD>> SGDBySidAsync(string sid)
        {
            return await sGDRepositoty.SGDBySidAsync(sid);
        }

        /// <summary>
        /// 修改薪酬发放详细数据
        /// </summary>
        /// <param name="sGDs"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task<int> SGDUpdateAsync(List<SGD> sGDs)
        {
            return await sGDRepositoty.SGDUpdateAsync(sGDs);
        }
    }
}
